package cn.iocoder.yudao.module.design.dal.mysql.reform;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.design.controller.admin.reform.vo.ReformExportReqVO;
import cn.iocoder.yudao.module.design.controller.admin.reform.vo.ReformPageReqVO;
import cn.iocoder.yudao.module.design.dal.dataobject.reform.ReformDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 项目整改单 Mapper
 *
 * @author czw 
 */
@Mapper
public interface ReformMapper extends BaseMapperX<ReformDO> {

    default PageResult<ReformDO> selectPage(ReformPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ReformDO>()
                .eqIfPresent(ReformDO::getHouseId, reqVO.getHouseId())
                .eqIfPresent(ReformDO::getFlowId, reqVO.getFlowId())
                .eqIfPresent(ReformDO::getNodeId, reqVO.getNodeId())
                .likeIfPresent(ReformDO::getName, reqVO.getName())
                .eqIfPresent(ReformDO::getStatusCd, reqVO.getStatusCd())
                .eqIfPresent(ReformDO::getConfirmUrl, reqVO.getConfirmUrl())
                .eqIfPresent(ReformDO::getCreator, reqVO.getCreator())
                .betweenIfPresent(ReformDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ReformDO::getReformType, reqVO.getReformType())
                .eqIfPresent(ReformDO::getConfirmUser, reqVO.getConfirmUser())
                .orderByDesc(ReformDO::getId));
    }

    default List<ReformDO> selectList(ReformExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ReformDO>()
                .eqIfPresent(ReformDO::getHouseId, reqVO.getHouseId())
                .eqIfPresent(ReformDO::getFlowId, reqVO.getFlowId())
                .eqIfPresent(ReformDO::getNodeId, reqVO.getNodeId())
                .likeIfPresent(ReformDO::getName, reqVO.getName())
                .eqIfPresent(ReformDO::getStatusCd, reqVO.getStatusCd())
                .eqIfPresent(ReformDO::getConfirmUrl, reqVO.getConfirmUrl())
                .eqIfPresent(ReformDO::getCreator, reqVO.getCreator())
                .betweenIfPresent(ReformDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ReformDO::getReformType, reqVO.getReformType())
                .eqIfPresent(ReformDO::getConfirmUser, reqVO.getConfirmUser())
                .orderByDesc(ReformDO::getId));
    }

}
